#include <cstring>

#include "hash.h"

#ifdef _MSC_VER
#include "msvc_io.h"
#else
#include "posix_io.h"
#endif

hash_t::hash_t() : init(false) { }


void hash_t::make(std::string &path)
{
    calc_hash(path, data);
    init = true;
}


bool hash_t::operator == (const hash_t &h1) const
{
    return memcmp(data, h1.data, sizeof(data)) == 0;
}


bool hash_t::operator < (const hash_t &h1) const
{
    return memcmp(data, h1.data, sizeof(data)) < 0;
}


bool hash_t::operator ! () const
{
    return !init;
}
